﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="DetailPage.aspx.cs" Inherits="DetailPage" %>
<%@ Import Namespace="System.Collections.Generic" %>
    <%@ Import Namespace="DBAccess" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<title><%=title %></title>
   <meta name="title" content="<%=title %>" />
        <meta name="description" content="<%=subcontent %>" />
        <meta name="keywords" content="cuời, hài, vui cuời, cuời sảng khoái" />
        <meta name="geo.placename" content="Ho Chi Minh City" />
        <link rel="canonical" href="<%=linkSubject %>" />
         <meta property="fb:app_id" content="425283504281234" />
        <meta name="og:title" content="<%=title %>"/>
         <meta property="og:url" content="<%=linkSubject %>" />
        <meta name="og:description" content="<%=subcontent %>" />
        <meta name="og:keywords" content="cuời, hài, vui cuời, cuời sảng khoái" />
         <meta name="og:image" content="<%=imageSubject %>" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<script>    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=425283504281234";
        fjs.parentNode.insertBefore(js, fjs);
    } (document, 'script', 'facebook-jssdk'));


    window.fbAsyncInit = function () {
        FB.init({
            appId: '425283504281234',
            status: true, // check login status
            cookie: true, // enable cookies to allow the server to access the session
            xfbml: true // parse XFBML
        });
        FB.Event.subscribe('edge.create', function (href, widget) {

            $.ajax({
                type: "post",
                async: true,
                url: "<%=host %>/Proccess/UpdateLikeFacebook.aspx?val=like",
                data: { href: href }
            });
        });
        FB.Event.subscribe('edge.remove', function (href, widget) {

            $.ajax({
                type: "post",
                async: true,
                url: "<%=host %>/Proccess/UpdateLikeFacebook.aspx?val=unlike",
                data: { href: href }
            });
        });
    }
    
    </script>
    <script type="text/javascript">

        var button;
        var userInfo;

        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
            fjs.parentNode.insertBefore(js, fjs);
        } (document, 'script', 'facebook-jssdk'));

        window.fbAsyncInit = function () {
            FB.init({
                appId: 425283504281234,
                status: true, // check login status
                cookie: true, // enable cookies to allow the server to access the session
                xfbml: true, // parse XFBML
                oauth: true
            });
            function updateButton(response) {
                button = document.getElementById('fb-auth');
                userInfo = document.getElementById('user-info');

                if (response.authResponse) {

                    FB.api('/me', function (info) {
                        login(response, info);
                    });

                    button.onclick = function () {
                        FB.logout(function (response) {
                            logout(response);
                        });
                    };
                } else {

                    LoginFacebook();
                }
            }
            FB.getLoginStatus(updateButton);
            FB.Event.subscribe('auth.statusChange', updateButton);
        };
        function login(response, info) {

            if (response.authResponse) {
                var accessToken = response.authResponse.accessToken;
                var avatar = 'https://graph.facebook.com/' + info.id + '/picture';
                $('#imgAvatar').attr("src", avatar);
                InsertAccount(info.name, info.email, avatar);
            }
        }

        function InsertAccount(username, email, avatar) {
            $.ajax({
                type: "post",
                url: "<%=host %>/Proccess/ProccessInsertAccount.aspx",
                async: false,
                data: { username: username, email: email, avatar: avatar },
                success: function (data2) {
                    if (data2 == "insertsuccess") {
                        // window.location.href = "<%=host %>/UploadPicture.aspx";
                    }

                }
            });
        }

        function LoginFacebook() {

            FB.login(function (response) {
                if (response.authResponse) {
                    FB.api('/me', function (info) {
                        login(response, info);
                    });
                } else {
                    //user cancelled login or did not grant authorization

                }
            }, { scope: 'email,user_birthday,status_update,publish_stream,user_about_me' });
        }
    </script>
 <div class="row">

                    <!-- Bread Crumb Start -->
                  <%--  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                        <ol class="breadcrumb">
                            <li><a href="javascript:;">Cười Haha</a></li>
                            <li class="active">Xem Gì</li>
                        </ol>
                    </div>--%>
                    <!-- Bread Crumb End -->
                    <!-- Content Column Start -->
                    <div class="col-lg-7 col-md-12 col-sm-12 col-xs-12 equalcol conentsection col-lg-push-4">

                        <!-- Contents Section Started -->

                        <div class="row">

                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                <!-- Video Box Start -->
                                <div class="videobox2 blogposttwo">
                                    <!-- Video Title Start -->
                                    <div class="text title-def">
                                        <h2><a href="#"><%=title %></a></h2>
                                        <ul class="tip-info">
                                            <li><i class="fa fa-user"></i> <strong><%=author %></strong> <small><%=publishDate %></small> </li>
                                            <li><i class="fa fa-eye"></i><strong><%=totalView %></strong> <small>lượt xem</small></li>
                                            <li><i class="fa fa-comments"></i><strong><%=totalLike %></strong> <small>thích</small></li>
                                        </ul>
                                    </div>
                                    <!-- Video Title End -->
                                    <figure>
                                      <%=content %>
                                    </figure>
                                    <div class="text">
                                        <div style="float:left; width:50%; padding-top:12px;"><div class="fb-like" data-href="<%=linkSubject %>" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div></div>
                                       <%-- <a href="javascript:;" class="btn btn-primary btn-sm backcolor backcolor alignright"><i class="fa fa-heart">&nbsp;</i>Đăng Ký </a>    --%>                                    
                                        <a href="javascript:;" class="btn btn-primary btn-sm backcolor alignright disabled"><i class="fa fa-thumbs-down">&nbsp;</i>Báo vi phạm</a>
                                        
                                    </div>
                                    <div class="text">
                                         <div class="fb-comments" data-href="<%=linkSubject %>" data-numposts="3" data-colorscheme="light"></div>
                                    </div>

                                  <%--  <div class="text bg-warning" style="height:300px"></div>--%>

                                </div>
                                <!-- Video Box End -->
                               
                            </div>

                        </div>
                        <!-- Contents Section End -->
                        <div class="clearfix"></div>
                        <hr />
                        <h3 style="margin-bottom:20px">Xem thêm các bài viết mới nhất</h3>

                        <div class="row">
                        <%
                       List<DBAccess.Object.Subject> lstLastet = DBAccess.Business.SubjectBusiness.GetListAllSubjectVisible(1, 0, 6);
                        {
                            if(lstLastet!=null&&lstLastet.Count>0)
                            {
                               string linkLastest="",imageLastest="";
                                foreach(DBAccess.Object.Subject sub in lstLastet)
                                {
                                    linkLastest = Utilitys.sefSubjectLink(sub.ID, sub.Title);
                                    imageLastest = modHost + sub.ImagePath;
                                %>
                                    <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
                                <!-- Video Box Start -->
                                <div class="videobox2">
                                    <figure>
                                        <!-- Video Thumbnail Start -->
                                        <a href="<%=linkLastest %>" title="<%=sub.Title %>">
                                            <img src="<%=imageLastest %>" style="width:209px; height:157px" class="img-responsive hovereffect" alt="<%=sub.Title %>">
                                        </a>
                                        <!-- Video Thumbnail End -->
                                        <!-- Video Info Start -->
                                        <div class="vidopts">
                                            <ul>
                                                <li><i class="fa fa-film"></i></li>                                               
                                            </ul>
                                            <div class="clearfix"></div>
                                        </div>
                                        <!-- Video Info End -->
                                    </figure>
                                    <!-- Video Title Start -->
                                    <h4><a href="video-detail-double-sidebar.html"><%=sub.Title %></a></h4>
                                    <label><small><%=sub.TotalView %> lượt xem</small></label>
                                    <!-- Video Title End -->
                                </div>
                                <!-- Video Box End -->
                            </div>
                                <%
                                }
                            }
                        }
         %>
                        
                        </div>


                    </div>
                    <!-- Content Column End -->
                    <!-- Gray Sidebar Start -->
                    <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12 equalcol graysidebar col-lg-pull-7">

                        <div class="widget">
                                                      
                            <div class="categorieslist user-cate-list">
                                <ul>
                                    <li><a href="javascript:;"><i class="fa fa-bar-chart-o"></i> Kênh của tôi</a> </li>
                                    <li> <a href="javascript:;"><i class="fa fa-sign-in"></i> Đăng ký của tôi</a> </li>
                                    <li> <a href="javascript:;"><i class="fa fa-video-camera"></i> Lịch sử đã xem</a> </li>
                                    <li> <a href="javascript:;"><i class="fa fa-flag"></i> Duyệt qua kênh</a> </li>
                                </ul>
                            </div>
                        </div>
                        <div class="clearfix"></div>

                        <!-- Small Video Posts Widget start -->
                        <div class="widget">
                            <h2 class="heading"><i class="fa  fa-film"></i> Clip Hot</h2>
                            <div class="videolistsmall">
                                <ul class="bloglist">
                                <%
                List<DBAccess.Object.Subject> lstVideo = DBAccess.Business.SubjectBusiness.GetListAllSubjectVideosVisibleMostView(1, 2, 0, 6);
                if (lstVideo != null && lstVideo.Count > 0)
                {
                    string linkVideo = "", imageVideo = "";
                    foreach (DBAccess.Object.Subject subject in lstVideo)
                    {
                        linkVideo = Utilitys.sefSubjectLink(subject.ID, subject.Title);
                        imageVideo = modHost + subject.ImagePath;
                                     %>
                                    <li>
                                        <div class="media">
                                            <a href="<%=linkVideo %>" title="<%=subject.Title %>" class="pull-left">
                                                <img class="media-object img-responsive hovereffect" style="width:90px; height:67px" src="<%=imageVideo %>" alt="<%=subject.Title %>" />
                                            </a>
                                            <div class="media-body">
                                                <h5><a href="<%=linkVideo %>" title="<%=subject.Title %>"><%=subject.Title %></a></h5>
                                                <ul>
                                                    <li><i class="fa fa-eye"></i> <%=subject.TotalView %></li>
                                                     <li><i class="fa fa-comment"></i> <%=subject.TotalLike %></li>
                                                </ul>
                                            </div>
                                        </div>
                                    </li>
                                   
                                   <%
                     }
                }
                                         %>
                                </ul>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <!-- Small Video Posts Widget End -->
                        <!-- Advertisement start -->
                        <div class="widget">
                            <img src="images/adv2.gif" class="img-responsive" alt="">
                        </div>
                        <div class="clearfix"></div>
                        <!-- Advertisement End -->
                        <!-- Recent Post Widget start -->
                        <div class="widget left-share">
                            <h2 class="help-block">Kết nối với Thapcam.vn</h2>
                            <div class="text">
                                <a href="javascript:;" class="btn btn-primary btn-sm"><i class="fa fa-thumbs-up"></i>&nbsp;Like</a>
                                <a href="javascript:;" class="btn btn-primary btn-sm"><i class="fa fa-facebook"></i>&nbsp;Share</a>

                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <!-- Recent Post Widget end -->

                    </div>
                    <!-- Gray Sidebar End -->



                </div>
                <script type="text/javascript">
                    $('.text bg-warning').css({ "height": "0px", "display": "none" });
                </script>
</asp:Content>

